<style>
body {
	text-align:center;
	margin:0px;
}

#service_staff_index_content {
	position: absolute;
	z-index: auto;
	height: auto;
	width: 1000px;
	left:0px;
	top:80px;
}
#service_staff_index_menu {
	width:400px;
	padding-left:20px;
	height:auto;
	text-align:left;

	
}
#service_staff_index_top {
	width:500px;
	height:auto;
	margin-top:10px;
	padding-left:250px;
	font-family:"ＭＳ Ｐゴシック", "ＭＳ ゴシック", "ＭＳ Ｐ明朝", "ＭＳ 明朝", "MS UI Gothic";
	font-size:14px;


}


#service_staff_index_content #service_staff_index_top table {
	font-family: "ＭＳ Ｐゴシック", "ＭＳ ゴシック", "ＭＳ Ｐ明朝", "ＭＳ 明朝", "MS UI Gothic";
	font-size: 14px;
}
</style>
	<!--{include /service/service_head}-->
	<div id="service_staff_index_content">
		<div id="service_staff_index_menu">
			<ul>
				${staffmanage_backend($oauthMap)}
			</ul>
		</div>
		
		<div id="service_staff_index_top">
			<p>{$errorMsg}</p>
			<table  border="0" cellpadding="1" cellspacing="0" width="500">
				<form action="/service/staffManageEdit.php" id="indexform" method="post">
					<tr>
						<td align="right">姓：
						  <input type="hidden" name="staff_id" value="{$staff['id']}"></td>
						<td><input type="text" size="11" name="family_name" class="f-input" value="{$staff['family_name']}" require="true" datatype="require|limit" min="2" />
						名：
						<input type="text" size="10" name="personal_name" class="f-input" value="{$staff['personal_name']}" require="true" datatype="require|limit" min="2" /></td>
					</tr>
					<tr>
						<td align="right">メールアドレス：</td>
						<td><input type="text" size="30" name="email" class="f-input" value="{$staff['email']}" require="true" datatype="require|limit" min="2" /></td>
					</tr>
					<tr>
						<td align="right">性別：</td>
						<td >
						<select name="sex" class="f-city">
							<option value="0">選択してください</option>
							${Utility::Option(array(0 => "女", 1 => "男"), $staff['sex'])}
						</select>
						</td>
					</tr>
					
					<tr>
						<td align="right">職員写真：</td>
						<td><input type="text" size="30" name="img" class="f-input" value="{$staff['img']}" require="true" datatype="require|limit" min="2" /></td>
					</tr>
					<tr>
						<td align="right">電話番号：</td>
						<td><input type="text" size="30" name="tel_no" class="f-input" value="{$staff['tel_no']}" require="true" datatype="require|limit" min="2" /></td>
					</tr>
					<tr>
						<td align="right">住所：</td>
						<td><input type="text" size="30" name="addr" class="f-input" value="{$staff['addr']}" require="true" datatype="require|limit" min="2" /></td>
					</tr>
					<tr>
						<td align="right">所属店舗：</td>
						<td>
							<select name="shop_id" class="f-city">
								<option value="0">選択してください</option>
								${Utility::Option(Utility::OptionArray($shopList, 'id', 'shop_name'), $staff['shop_id'])}
							</select>
						</td>
					</tr>
					<tr>
						<td align="right">pr：</td>
						<td><input type="text" size="30" name="pr" class="f-input" value="{$staff['pr']}" require="true" datatype="require|limit" min="2" /></td>
					</tr>
					<!--{if $staff['id'] > 0}-->
					<tr>
						<td align="right">スキル：</td>
					
						<td id="addDelete">
							<!--{loop StaffSkill::GetServicesById($staff['id']) $index1 $one1}-->
							<!--{if $index1 != 0}-->
							<BR>
							<!--{/if}-->
							<span><font size="2">{$one1['service_name']}(level:{$one1['skill_level']})</font> 
							<a class="delete" staffId="{$staff['id']}" serviceId="{$one1['id']}"></a></span>

							<!--{/loop}-->
							
						</td>
						
					</tr>
					<tr>
						<td align="right">スキルの追加：</td>
						<td>
							<select name="service_id" class="f-city">
								<option value="0">選択してください</option>
								${Utility::Option(Utility::OptionArray($serviceList, 'id', 'service_name'), 0)}
							</select>
							<font size="2"> 技能レベル</font>:
							<select name="resetTime" class="f-city">
								<option value="1">1</option>
								<option value="2">2</option>
								<option value="3">3</option>
							</select>
							<input type="button" value="追加" id="addService" /><font color="red" size="2"><BR>※技能レベル1が最高レベルです。</font>
						</td>
					</tr>
					<!--{/if}-->
					<tr>
						
					</tr>
					
					<tr>
						<td align="right">給料種類：</td>
						<td>
							<select name="salary_type" class="f-city">
								<option value="0">選択してください</option>
								${Utility::Option(array(0 => "時給", 1 => "月給"), $staff['salary_type'])}
							</select>
						</td>
					</tr>
					<tr>
						<td align="right">時給：</td>
						<td><input type="text" size="30" name="salary" class="f-input" value="{$staff['salary']}" require="true" datatype="require|limit" min="2" />円</td>
					</tr>
					<tr>
					  <td align="right">&nbsp;</td>
					  <td>&nbsp;</td>
				  </tr>
					
					<tr>
						<td></td>
						<td>
						<!--{if $oauthMap[31] != null}-->
						<!--<input type="submit" size="30" name="denglu"/>--><!--{/if}-->
						</td>
						
					</tr>
					<tr>
					  <td></td>
					  <td><input type="submit" size="30" name="登録"/></td>
				  </tr>
					<tr>
					  <td></td>
					  <td>&nbsp;</td>
				  </tr>
					<tr>
					  <td align="right"><a href="staffManage.php">戻る</a></td>
					  <td>&nbsp;</td>
				  </tr>
					
				</form>
			</table>
			<div>
			<!-- <a href="{$_SERVER['HTTP_REFERER']}">戻る</a> --><a href="staffManage.php"></a></div>
		</div>
		
	</div>
</body>
</html>
<script type="text/javascript"><!-- 
jQuery(function(){
	$("a[class='delete']").bind('click', function(){
		var data = "action=del&serviceId=" + $(this).attr("serviceId") + "&staffId=" + $(this).attr('staffId');
		var This = this;
		$.get("{$webRoot}/service/staffSkillEdit.php", data, function(data){
			if( data['error'] == 0 ){
				$(This).next().remove();
				$(This).unbind('click');
				$(This).remove();
			}
			
		}, "json");
	});

	$("#addService").bind('click', function(){
		var staffId = $("input[name='staff_id']").val();
		var serviceId = $("select[name='service_id']").val();
		var resetTime = $("select[name='resetTime']").val();
		if( serviceId < 1 ){
			return ;
		}
		var data = "action=add&serviceId=" + serviceId + "&staffId=" + staffId + "&resetTime=" + resetTime;
		$.get("{$webRoot}/service/staffSkillEdit.php", data, function(data){
			if( data['error'] == 0 ){
				$("#addDelete").append('<a class="delete" staffId="' + staffId + '" serviceId="' + serviceId + '"></a><span>' + data.data + '</span>');
				$("a[class='delete']").last().bind('click', function(){
					var data = "action=del&serviceId=" + $(this).attr("serviceId") + "&staffId=" + $(this).attr('staffId');
					var This = this;
					$.get("{$webRoot}/service/staffSkillEdit.php", data, function(data){
						if( data['error'] == 0 ){
							$(This).next().remove();
							$(This).unbind('click');
							$(This).remove();
						}
						
					}, "json");
				})
			}
		}, "json");
	});

	$("select[name='shop_id']").bind("change", function(){
		if( $(this).val() < 1 ){
			return ;
		}
		$.get("{$webRoot}/ajax/GetServiceList.php", "shopId=" + $(this).val(), function(data){
			var options = '<option value="0">選択してください</option>';
			for(var index in data.data){
				if( !index ){
					continue;
				}
				options = options + '<option value="' + index + '">' + data.data[index].service_name + '</option>';
			}
			$("select[name='service_id']").html(options);
		}, "json");
		
	});

	
	/*$("select[name='shop_id']").bind("change", function(){
		var url = "/mapreengage/ajax/getServices.php" + "?shopId=" + $(this).val();
		$.getJSON(url,
			function(data){
				var myobj = data;
				var htmlOption = '<option value="0">選択してください</option>';
				for(s in myobj){
					htmlOption += '<option value="' + s + '">' + myobj[s] + '</option>';;
				}
				$("select[name='service_id[]']").html( htmlOption );
			}
		);  
	});*/
});
--></script> 
</html> 